package com.usefullc.system.service.component.scheduler;

import com.usefullc.system.service.DataDictService;
import com.usefullc.system.service.JobTemplateService;
import com.usefullc.system.service.MessagePublishService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author: Sampson
 * @date: 2022-09-06 11:43
 *
 */
@Slf4j
public class QuartzJob implements Job {

    @Autowired
    private JobTemplateService jobTemplateService;

    @Autowired
    private DataDictService dataDictService;

    @Autowired
    private MessagePublishService messagePublishService;


    @Override
    public void execute(JobExecutionContext context) {
//        Object param = context.getJobDetail().getJobDataMap().get("param");
        String key = context.getJobDetail().getKey().getName();
        Long id = Long.valueOf(key);
        jobTemplateService.publish(id,null);

    }
}
